package com.leetcode.LC;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

public class LC1431 {
    public List<Boolean> kidsWithCandies(int[] candies, int extraCandies) {
        //排序得到最大值，此后一直与这个最大值做比较
        int max = 0;
        for (int candy : candies) {
            max = Math.max(max, candy);
        }
        ArrayList<Boolean> list = new ArrayList<>();

        for (int candy : candies) {
            if (candy + extraCandies >= max) {
                list.add(true);
            } else {
                list.add(false);
            }
        }
        return list;
    }
}
